package com.five.dao.impl.backstage;

import com.five.dao.backstage.Staff1Dao;
import com.five.entity.backstage.TStaff;
import com.five.util.DBUtil;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.List;

/**
 * @Author: 越川豪
 * @Date: 2020/11/27 11:14
 */
@Repository
public class Staff1DaoImpl implements Staff1Dao {

    //查询信息
    @Override
    public List find(String name) {
        String sql = "select s.id,s.name,rzdate,address,r.name rolename,d.name deptname from t_staff s,t_role r,t_dept d WHERE s.roleid=r.id and s.roleid=d.id and s.name = ? ";
        return DBUtil.queryMap(sql, name);
    }

    //    修改地址
    @Override
    public int update(String address, String name) {
        String sql = "update t_staff set address = ? where name = ?";
        return DBUtil.manage(sql, address, name);
    }

    //    上传头像
    @Override
    public int refresh(String path, String name) {
        String sql = "update t_staff set imgpath = ? where name = ?";
        return DBUtil.manage(sql,path,name);
    }
}
